Creating a proxy object and providing information related to a proxy object

ABSTRACT

A method, system, and computer readable medium for creating a proxy object, comprises calling a second functionality in a proxy class, creating a proxy object by the second functionality, calling a third functionality by the second functionality, calling a fourth functionality by the third functionality, creating a reference object by the fourth functionality, returning the reference object to the third functionality, associating the reference object to the proxy object by the third functionality, and returning the associated proxy object by the second functionality to a first functionality.

CROSS REFERENCE TO RELATED APPLICATIONS

The present invention is related to patent application Ser. No. 10/975,146, entitled PERFORMING OPERATIONS BY A FIRST FUNCTIONALITY WITHIN A SECOND FUNCTIONALITY IN A SAME OR IN A DIFFERENT PROGRAMMING LANGUAGE and to patent application Ser. No. 10/975,827 entitled CALLING A SECOND FUNCTIONALITY BY A FIRST FUNCTIONALITY, which are incorporated by reference herein, assigned to the assignee of the present invention, and are filed on even date herewith.

BACKGROUND OF THE INVENTION

The present invention is related to proxy objects, and, more specifically to creating a proxy object and providing information related to a proxy object.

According to the present invention, an architect console is utilized through which at least one proxy and adapter are provided to a selected source. The architect console analyzes source code, methods within classes that will be exposed are selected, and mapping and various generation options for those methods are provided. The analyzing allows a database of classes, methods, and fields to be built. Based on a received command, all of the proxies, adapters and streamers that will be needed to perform invocations (for example, remote invocations) are generated in an appropriate source language. For example, if a server associated with JAVA code whose functionality is to be exposed to a C++ client, then JAVA adapters are generated for the server, and C++ source code proxies are generated for the client.

Within the proxy of the present invention, initialization code, at least one proxy method, and at least one lookup method exist. The initialization code registers a type of that proxy within the run time, and registers method streamers used to marshal and unmarshal arguments, and return values passed during remote invocations. The proxy methods have the same signature as the business method of the object that is being exposed. As such, the client “believes” that it is accessing the business object directly but it is really invoking the business object through the proxy. The lookup method is called by the client in order to acquire a proxy that is found in a naming service.

Within the adapter of the present invention, at least one bind method, and an invoke method, exist. The bind method can be called to register an adapter in the naming service, while the invoke method, which will be called by the run time, will dispatch the invocation to the appropriate business method.

A problem exists in the current art of effectively and efficiently acquiring an initial remote reference to a remote object. In order to do so, the present invention comprises a naming service that binds an object into a well known name, and a client that uses that well known name to acquire a proxy to the object in as few steps as possible.

SUMMARY OF THE INVENTION

The present invention overcomes prior art problems and limitations by creating a proxy object and by providing information related to a proxy object.

In one embodiment, a method for creating a proxy object, comprises calling a second functionality in a proxy class, creating a proxy object by the second functionality, calling a third functionality by the second functionality, calling a fourth functionality by the third functionality, creating a reference object by the fourth functionality, returning the reference object to the third functionality, associating the reference object to the proxy object by the third functionality, and returning the associated proxy object by the second functionality to a first functionality.

In another embodiment, a method for providing information related to a proxy object to a first functionality comprises receiving a lookup URL by a second functionality, calling a third functionality based on the lookup URL, and returning the information based on the called third functionality.

In a further embodiment, a computer readable medium comprises instructions for calling a functionality in a proxy class, creating a proxy object by the functionality, creating a reference object by another functionality, and associating the reference object to the proxy object by a further functionality.

In yet another embodiment, a computer readable medium comprises instructions for receiving a lookup URL, calling a functionality based on the lookup URL, and returning information related to a proxy object based on the called third functionality.

In yet a further embodiment, a system for creating a proxy object, comprises a client adapted to call a second functionality in a proxy class, create a proxy object by the second functionality, create a reference object by a fourth functionality, return the reference object to a third functionality, associate the reference object to the proxy object by the third functionality, and return the associated proxy object by the second functionality to a first functionality.

In yet another embodiment, a system for providing information related to a proxy object, comprises a server adapted to receive a lookup URL, and call a functionality based on the lookup URL, and a client adapted to receive information from the server based on the called third functionality.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 depicts a flow diagram of a client performing a remote invocation in accordance with a preferred embodiment of the present invention; and

FIG. 2 depicts a flow diagram of a server responding to the client performing the remote invocation in accordance with a preferred embodiment of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

FIG. 1 depicts a flow diagram 10 of a client 12 performing a remote invocation. A method 14 a in a business object 16 is called on the client 12 and the business object 16 performs a remote invocation within that method 14 a. A proxy method 14 is called on a proxy 18 passing various arguments. The proxy 18, which is generated by an architect console (not shown), calls a super class invoke method (not shown) which performs an invoke method 20 on a reference holder 22. The reference holder 22 is an object that contains information necessary to perform the remote invocation in terms of having the address of the object, being able to acquire a connection to it and sending the data to a server side (not shown) using that connection.

When a remote reference is acquired, either by performing a lookup (described further below) or as the result of the server returning a remote reference through another invocation, the reference information is encapsulated in data that is passed back to the client. The client then uses the information to create the address information, the reference holder and reference, and proxy, to be able to perform that invocation. The present invention includes a two-layer design for the reference information in that multiple protocols are supported. The reference holder 22 contains the information that is necessary for performing any kind of remote invocation. Protocol specific references 24, such as IRMP reference, SOAP reference, the JAVA run time, and others, are further supported by the present invention. These references 24 provide the mechanism to perform communication in the appropriate messaging protocol for that type of reference. For example, a SOAP reference takes an invocation consisting of the proxy 18 which is being invoked on, and the arguments. A connection 32 (such a TCP connection) to the server is acquired 30 (via a transport 28) based on the address of the proxy 18 that is being invoked on. The message is then sent 34 in the appropriate protocol via the connection 32 and a response 36 from the connection is received.

The appropriate protocol for a reference is decided upon when a lookup is performed or when a remote invocation returns a remote reference. During such instances, information is received, such as the address information, that is used to create a reference of the appropriate type. In the case of a lookup, part of the information that is passed includes the naming protocol to use. The naming protocol is associated with a messaging protocol.

If a server is returning a remote reference to the client as part of an invocation, and since the remote reference is going to be processed by a SOAP reference or an IRMP reference, for example, the server will already know this fact. In a naming service, when a lookup is performed, information is passed that is in a URL format. For example, an irmp://host:port/name URL would be passed to perform a lookup in the IRMP protocol. When a reference (IRMP or SOAP, for example) sends the invocation out across the network, it marshals the arguments in the appropriate protocol format (IRMP or SOAP), and sends any other necessary information to perform the invocation across the network to the server. Using the message streamer registered in the proxy initialization code, the argument types that are being passed can be ascertained and those streamers are able to marshal the argument of that type in the appropriate protocol. As such, streamers for native primitive object types (such as integer and string for both IRMP and SOAP) exist and if custom types exist that will be passed back and forth, then streamers for those types would be present as well. When a response is received, any objects that were returned by the server are unmarshaled using the appropriate streamer.

The initialization code for the proxy consists of registering a type within the run time and registering method streamers for every method that the proxy exposes. The type is the unique string that uniquely identifies that type. This allows the distributed system of the present invention to be cross-language and permits the mapping from a generic cross-language type to the appropriate language-specific type.

Referring now to FIG. 2, a flow diagram 40 of a server 42 responding to the client 12 performing the remote invocation is depicted. A request manager 44, which is associated with the connection 32, is adapted to receive incoming invocations via the connection. When the request manager 44 begins to receive an incoming invocation, it inquires as to the ability of each request handler 46 (which is protocol specific and is a counter-part to the client side protocol specific reference 24) to process 48 the incoming invocation. If a request handler 46 is able to process the invocation, the connection is handed off to the appropriate request handler 46. The request handler 46 receives the incoming invocation from the connection 32 and reads the request off of the stream. In other words, the request handler 46 is reading the data off the socket and turning it into actual invocation data that is going to be processed. The request handler 46 uses streamers as the client 12 with an exception that where the client is streaming language-specific objects to protocol-specific data, the streaming occurs from protocol-specific to language-specific. In addition, the streamers may have been in a different language to the client side streamers, for example Java instead of C++. The invocation includes information such as the arguments and other information that is necessary to uniquely resolve the object that will be invoked and perform the invocation.

Once this information is received, an adapter 58 for that object is obtained from an ORB server 54 that maintains a mapping between an object ID and the adapter for that object. Based on the foregoing, the adapter that is going to be invoked is determined. The request handler 46 performs an invocation 56 which is received by the adapter 58 which is comprised of code generated from the architect console. The code, based on the operation that is being performed, calls a particular method 60 on the actual business object 62. At this point, the actual business method is called with the arguments and performs a particular operation such as, for example, transferring money from one account to another account. A response 64 is returned to the client 12 via the request handler 46 and the connection 32. The client decodes the response 64 concluding the remote invocation.

In one embodiment of the present invention, a method for a first functionality (such as a client) in a programming language to perform operations within a second functionality (such as a server) in the programming language or in a different programming language comprises creating an adapter object for the second functionality, binding the adapter object within a naming service, looking-up a proxy object for the adapter object, and calling the second functionality through the proxy object by the first functionality. The second functionality can also be called through the adapter by the first functionality. The binding includes associating the adapter object to a URL within the naming service.

The adapter object further includes means to call the second functionality, wherein the second functionality is a business object, and wherein the business object consists of at least one operation. The means to call the second functionality includes at least one of: mapping a required name of the operation to the operation, and calling the operation with optional information to be passed to the operation, wherein the information includes arguments to the operation, and wherein the operation is a business method.

The adapter object and the second functionality are instances of classes, wherein the classes are in the same programming language. Further, the proxy object and the first functionality are instances of classes, wherein the classes are in the same programming language.

In a further embodiment, a computer readable medium comprises instructions for creating an adapter object for a second functionality, binding the adapter object within a naming service, wherein the binding associates the adapter object to a URL, looking-up a proxy object for the adapter object based on the URL, providing the proxy object to a first functionality, and calling the second functionality through the proxy object by the first functionality. The computer readable medium further comprises performing operations by the first functionality in a programming language within a second functionality in the programming language or in a different programming language.

The discussion will now center on how a lookup is performed via the client 12 to resolve the appropriate type of messaging protocol that will be used. Although not depicted, the client 12 can perform the lookup to obtain the proxy within the business object itself or elsewhere and then provide the proxy to the business object. When the proxy's lookup method passes in the URL format (consisting of an optional scheme-specific portion and a required scheme-specific portion), a client side naming service extracts the scheme, looks up a client side naming service using that scheme and then passes the lookup to that client type naming service. Effectively, a naming service interface exists which includes the aforementioned lookup method (as well as other methods) and implementations of the naming service (such as the IRMP naming service and the SOAP naming service, for example) which provide the implementation of that lookup using the messaging protocol associated with that naming service. For example, if an IRMP naming service is being used to perform a lookup, the IRMP naming service performs a remote invocation using the IRMP protocol to obtain the remote reference to that object.

This remote invocation is a static invocation whereby a name space class exists on a server as well as on the client. The name space class contains static methods for naming service operations including, lookup, bind, unbind, and rebind, as well as a registry of naming services. As such, when a lookup is performed, the name space class resolves the appropriate naming service and then hands off the lookup invocation to that naming service. The remote invocation is unique as it provides a simple, single point of entry for all naming service operations. In contrast, systems including an object request broker require a plurality of steps to be taken before naming service type operations can occur. The present invention provides the static methods directly through the name space class. The use of static methods allows a lookup to be performed in as few steps as possible.

Once the server receives the lookup operation (utilizing the name space class), it extracts the scheme and then hands off the invocation to the IRMP naming service. The URL, which is local to this process and includes the scheme which is used by the name space to get the appropriate naming service, is received by a directory which returns the actual proxy back to the client via the previously described mechanism.

The naming service is a combination of a naming and directory service, which is capable of being federated across multiple processes. Using the IRMP naming service as an example, if a lookup is performed on the URL irmp://server/hotels/Dallas/Radisson, the portions of the URL include a scheme (irmp) as well as scheme specific portions including a host (server), a path (hotels/Dallas), and a name (Radisson). Once the host is reached, the rest of the URL is passed to the directory which breaks the rest of the URL down into individual components. Let us assume that within the server (the primary server) a directory of hotels exists and that another server, which is running in Dallas, includes a directory called Dallas. When the server in Dallas is initiated, it starts up its directory and binds that directory into the primary server. Therefore, looking at the actual objects on the server, a directory with the name hotels exists with a directory proxy positioned beneath it with the name of Dallas. When the top level hotels directory receives a lookup, it is broken up with the rest of the URL passed off to the directory proxy. Since the Dallas directory is a proxy, it will perform a remote invocation to the server in Dallas which actually includes the Radisson name beneath it. Thus, the proxy is returned from the server to the client via the primary server.

A federated naming service is thus provided where a client only needs to know a URL or a host of the primary server. Service for every city can then be bound into either of those references transparently to the client. Basically, the business object is bound to the bind method which creates an adapter wrapping that business object and binds the adapter into the naming service. Similarly, the server that starts up in Dallas includes an indicator (via, for example, software) that is aware of the primary server. However, the code that binds the Radisson Hotel beneath Dallas only needs to be aware of the directory which it binds itself into regardless of where that directory is actually located. When the server performs a bind to an adapter (such as a bind to server/hotels/Dallas/Radisson), it needs to know the full path but it does not need to know that Dallas is actually being hosted on a server in Dallas.

In one embodiment of the present invention, with respect to the lookup method, a method for creating a proxy object comprises calling a second functionality (such as a method in a proxy class), creating a proxy object by the second functionality, calling a third functionality (such as a method in a naming service registry class) by the second functionality, calling a fourth functionality (such as a method in a naming service implementation class) by the third functionality, creating a reference object by the fourth functionality, returning the reference object to the third functionality, associating the reference object to the proxy object by the third functionality, and returning the associated proxy object by the second functionality to a first functionality (such as an object of a class).

The method further includes by passing a URL to the second functionality, passing the proxy object and the URL to the third functionality, wherein the URL includes at least one of an optional scheme portion and a required scheme-specific portion, mapping the scheme portion to a naming service implementation, and passing the URL to the fourth functionality by the third functionality, wherein the naming service implementation contains the fourth functionality.

In another embodiment of the present invention, with respect to the lookup method, a method for providing information related to a proxy object to a first functionality (such as a client) comprises receiving a lookup URL by a second functionality (such as a directory naming service or, for example, an IRMP Naming Service), calling a third functionality based on the lookup URL, and returning the information based on the called third functionality. The information, which includes an address of the object, wherein the address includes an URL and an object ID related to the proxy, is returned to the first functionality which utilizes the URL and the object ID to construct a proxy object.

The lookup URL is at least one of a local lookup URL and a remote lookup URL. The third functionality described above is a local directory if the lookup URL is local, wherein the lookup URL is local if there is a server socket running on the lookup URL that is local to the process. Conversely, the third functionality is a remote directory if the lookup URL is remote, wherein the lookup URL is remote if there is a server socket running on the lookup URL that is remote to the process.

Calling the third functionality consists of utilizing the lookup URL to obtain the information, or, more specifically, splitting the lookup URL to obtain the information at a path level for the third functionality, wherein the third functionality includes a name related to the path. A directory splits the URL at a path level. Each directory name in the path (hotels/Dallas) is associated with a particular directory and the remainder of the URL is provided to each directory until the directory is reached that has the actual entry in it. That directory then looks up the entry (Radisson). This occurs whether URL is local or remote.

Although an exemplary embodiment of the system, method, and computer readable medium of the present invention has been illustrated in the accompanied drawings and described in the foregoing detailed description, it will be understood that the invention is not limited to the embodiments disclosed, but is capable of numerous rearrangements, modifications, and substitutions without departing from the spirit of the invention as set forth and defined by the following claims. For example, the capabilities of the client 12 and/or the server 42 can be performed by one or more modules in a distributed architecture and on or via any device able to transfer information between the client and the server. Further, the functionality performed by the elements within the client 12 and/or the server 42 may be performed by one or more of the elements such as the reference holder 22 or the request handler 46. 

1. A method for creating a proxy object, comprising: calling a second functionality in a proxy class and passing information to the second functionality to enable a lookup to be performed; creating a proxy object by the second functionality; calling a third functionality by the second functionality and passing at least the information to the third functionality, wherein the third functionality uses the information to lookup a fourth functionality; calling a fourth functionality by the third functionality and passing at least the information to the fourth functionality; creating a reference object by the fourth functionality, the reference object being associated with the information; returning the reference object to the third functionality; associating the reference object with the proxy object by the third functionality; and returning the associated proxy object by the second functionality to a first functionality.
 2. The method of claim 1, wherein the passing information to the second functionality further comprises passing a URL to the second functionality.
 3. The method of claim 2, wherein the passing at least the information to the third functionality further comprises passing the proxy object to the third functionality.
 4. The method of claim 2, wherein passing a URL includes passing at least one of: an optional scheme portion; or a required scheme-specific portion.
 5. The method of claim 4, wherein the lookup performed by the third functionality comprises mapping the scheme portion to a naming service implementation.
 6. The method of claim 5, wherein the naming service implementation contains the fourth functionality.
 7. The method of claim 1, wherein the first functionality is an object of a class.
 8. The method of claim 1, wherein the second functionality is a method in the proxy class.
 9. The method of claim 1, wherein the third functionality is a method in a naming service registry class.
 10. The method of claim 1, wherein the fourth functionality is a method in a naming service implementation class.
 11. A computer readable storage medium having computer executable instructions stored thereon, the instructions comprising: instructions to call a second functionality in a proxy class and passing information to the second functionality to enable a lookup to be performed; instructions to create a proxy object by the second functionality; instructions to call a third functionality by the second functionality and passing at least the information to the third functionality, wherein the third functionality uses the information to lookup a fourth functionality; instructions to call a fourth functionality by the third functionality and passing at least the information to the fourth functionality; instructions to create a reference object by the fourth functionality, the reference object being associated with the information; instructions to return the reference object to the third functionality; instructions to associate the reference object with the proxy object by the third functionality; and instructions to return the associated proxy object by the second functionality to a first functionality.
 12. The computer readable storage medium of claim 11, wherein the instructions to pass information to the second functionality comprise instructions to pass a URL to the second functionality.
 13. The computer readable storage medium of claim 12, wherein the instructions to pass at least the information to the third functionality further comprise instructions to pass the proxy object to the third functionality.
 14. The computer readable storage medium of claim 12, wherein the instructions to pass a URL include instructions to pass at least one of: an optional scheme portion; or a required scheme-specific portion.
 15. The computer readable storage medium of claim 14, wherein the lookup performed by the third functionality comprises mapping the scheme portion to a naming service implementation.
 16. The computer readable storage medium of claim 15, wherein the naming service implementation contains the fourth functionality.
 17. The computer readable storage medium of claim 11, wherein the first functionality is an object of a class.
 18. The computer readable storage medium of claim 11, wherein the second functionality is a method in the proxy class.
 19. The computer readable storage medium of claim 11, wherein the third functionality is a method in a naming service registry class.
 20. The computer readable storage medium of claim 11, wherein the fourth functionality is a method in a naming service implementation class. 